package config;

import bean.MyBean;
import com.alibaba.fastjson.JSON;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


public class MyBeanIniti {

    public static void main(String[] args){
        //使用AnnotationConfigApplicationContext作为Spring容器，接受输入一个配置类作为参数；
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(BeanConfig.class);
        //2、获得声明配置的MyBean的Bean。
        MyBean bean = context.getBean(MyBean.class);
        bean.setId(23);
        bean.setName("bean");

        System.out.println(JSON.toJSONString(bean));
        context.close();
    }
}
